import java.util.Arrays;

public class Test2 {
    //3、静态初始化一维数组{10,20,11,35,6,89}，进行冒泡排序
    public static void main(String[] args) {
        int num[] = {10, 20, 11, 35, 6, 89};
        int temp;
        for (int i = 0; i < num.length - 1; i++) { //外层循环控制比较轮数
            //System.out.println("第"+(i+1)+"轮");
            for (int j = 0; j < num.length - i - 1; j++) { //内层循环控制每一轮比较次数
                if (num[j] > num[j + 1]) {
                    temp = num[j];
                    num[j] = num[j + 1];
                    num[j + 1] = temp;
                }
                //System.out.println(Arrays.toString(num));
            }
        }
        System.out.println("数组升序排序如下：");
        System.out.println(Arrays.toString(num));
    }

}
